October 23, 1993

Sam's Sensable Sleeper V1.00

Brought to you by:

Sam's Software Shoppe

This package is shareware, if you use it
you are requested to send $5 to 

Sam's Software Shoppe
220 W. Bell Rd., #2057
Phoenix, AZ  85023

comments to:  riedesel@inference.com

What is it?
----------
Sam's Sensable Sleeper, when turned on, detects whether you are operating
by plug or by battery.  You may then set the sleep time on your Newton based
on whether you are using the plug or the battery.  Thus, if most of the time
you use the plug (at your office where your plug is, perhaps), you can set sleep
to never.  When you then carry it around off the plug, you can have the sleep be,
say, 1 minute.  This way, you don't have to always dive through a zillion menus
just to reset the sleep.  You do it once with this package and the package will
do it for you from then on (if you turn it on).

How does it work?
-----------------
Ugh.  Via a couple of hacks.
By setting trace to 'functions, I was able to find the function "BatteryLevel(0)"
which returns an integer between 0 and 100.  So, if the value ever goes below
100, then I assume we don't have a plug (probably a safe assumption).
Unfortunately, while the battery is fresh, I don't know if you have a plug or
a battery.  Anyone know a better way to detect if the Newton is plugged in?

The second thing is a viewIdleScript.  This seems to require that the view remain
open in order to keep the idle script going.  Therefore, I hide the view instead
of closing it when the close box is tapped.  Well, then I only want to show it when
the icon for the package is tapped.  Easier said than done.  Ever try to change the 
buttonClickScript on those views in the ExtrasDrawer?  Everytime the drawer
is closed those views are gone.  Now what?  So my viewIdleScript also tries to
keep the buttonClickScript up to date.

The upshot of this is that I have the viewIdleScript running every second.  This is
so that the buttonClickScript is set appropriately before the user really has
a chance to get to it.  

One shouldn't have to go through these contortions to do something simple like
this?  If anyone can recommend how to do what I'm really trying to do, please,
tell me.
It bugs me that the code is really quite simple; but to get it to work the way I
think it should be able to on the Newton is less than trivial (understatement).

Recommendations
----------------
Sam's Software Shoppe recommends that you install this package
in your internal memory rather than on a card or other storage device.
The package is simple in concept, but difficult to implement and thus
won't allow you to remove external storage if you install it on external
storage.

Caveats
-------
Sam's Software Shoppe makes no guarantees regarding this product.
Sam's Software Shoppe is not responsible for any loss resulting from the
use of this product.
